﻿using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace CombatAutomationTheater
{
    [DataContract]
    public class CharacterVisionType
    {
        public enum VisionType
        {
            Normal,
            LowLight,
            Darkvision,
            LowLightAndDarkVision
        }
        
        [DataMember]
        public VisionType CurrentVisionType { get; set; }

        [DataMember]
        public double Distance { get; set; }

        public CharacterVisionType (VisionType type = VisionType.Normal, double dist = 60)
        {
            CurrentVisionType = type;
            Distance = dist;
        }


        public CharacterVisionType IncreaseType()
        {
            var newval = VisionType.Normal;
            switch (CurrentVisionType)
            {
                case VisionType.Normal:
                    newval = VisionType.LowLight;
                    break;
                case VisionType.LowLight:
                    newval = VisionType.Darkvision;
                    break;
                case VisionType.Darkvision:
                    newval = VisionType.LowLightAndDarkVision;
                    break;
                case VisionType.LowLightAndDarkVision:
                    newval = VisionType.Normal;
                    break;
            }
            var ret = new CharacterVisionType(newval, Distance);
            return ret;
        }
    }
}